package com.czl.base.data.api

import com.czl.base.base.BaseBean
import com.czl.base.data.bean.*
import io.reactivex.Observable
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author Alwyn
 * @Date 2020/7/22
 * @Description
 */
interface ApiService {

    /**
     * 登录
     */
//    @Headers("Domain-Name: douban") // Add the Domain-Name header
//    @POST("system/app/user/login/pwd")
    @POST("auth/appLogin")
    fun loginByPwd(
        @Body info: RequestBody
    ): Observable<BaseBean<LoginUser>>

    /**
     * 验证码登录
     */
    @POST("system/app/user/login/vc")
    fun loginByPhoneCode(
        @Body info: RequestBody
    ): Observable<BaseBean<LoginUser>>

    /**
     * 删除个人车辆
     */
    @POST("parking/app/parking/vehicle/delete")
    fun deleteCarList(
        @Body info: RequestBody
    ): Observable<BaseBean<Any?>>

    /**
     * 我的查询历史车辆列表
     */
    @POST("parking/app/parking/vehicle/myQueryHistory")
    fun getMyQueryHistory(): Observable<BaseBean<List<CarItem>>>

    /**
     * 获取用户详细信息
     */
    @GET("system/user/profile/app")
    fun getUserInfoNet(): Observable<BaseBean<UserInfo>>

    /**
     * 获取热线
     */
    @GET("system/app/user/hotLine")
    fun getHotLine(@Query("areaId") areaId: String): Observable<BaseBean<String>>

    /**
     * 获取注销须知
     */
    @GET("system/config/logoutNotice")
    fun getDeleteNotice(): Observable<BaseBean<String>>

    /**
     * 退出登录
     */
    @DELETE("auth/logout")
    fun logout(): Observable<BaseBean<Any?>>

    /**
     * 获取手机验证码
     */
    @POST("system/app/user/verifyCode")
    fun getPhoneCode(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 修改用户信息
     */
    @PUT("system/user/profile/app")
    fun changeUserInfo(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 找回密码
     */
    @POST("user/profile/retrievePassword")
    fun retrievePassword(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 修改密码
     */
    @PUT("system/user/profile/updatePwd")
    @FormUrlEncoded
    fun verifyPwdNet(
        @Field("newPassword") newPassword: String,
        @Field("oldPassword") oldPassword: String
    ): Observable<BaseBean<Any?>>

    /**
     * 初始化密码
     */
    @POST("system/app/user/initPassword")
    fun initPassword(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 添加个人车辆
     */
    @POST("parking/app/parking/vehicle/add")
    fun addPersonCar(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 物业接单
     */
    @POST("property/workOrder/repair/take")
    fun takeRepair(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 物业转单
     */
    @POST("property/workOrder/repair/turn")
    fun turnRepair(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 业主评价工单
     */
    @POST("property/workOrder/repair/evaluate")
    fun evaluateOrder(@Body info: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 获取月卡列表
     */
    @POST("parking/app/parking/parkingCard/myCardList")
    fun getMonthCardList(@Body info: RequestBody): Observable<BaseBean<MonthCardListBean>>

    /**
     * 分页查询个人消息列表
     */
    @POST("property/message/profileList")
    fun getNoticeMsgList(@Body info: RequestBody): Observable<BaseBean<NoticeMsgListBean>>

    /**
     * 阅读指定消息
     */
    @GET("property/message/read")
    fun readNotice(@Query("msgId") msgId: String): Observable<BaseBean<Any?>>

    /**
     * 缴费记录
     */
    @POST("payment/orders/parking/list")
    fun getPayRecordList(@Body info: RequestBody): Observable<BaseBean<PayRecordListBean>>

    /**
     * APP查询维修记录
     */
    @POST("property/workOrder/repair/repairList")
    fun getRepairList(@Body info: RequestBody): Observable<BaseBean<RepairListBean>>

    /**
     * APP查询报修记录
     */
    @POST("property/workOrder/repair/reportList")
    fun getReportList(@Body info: RequestBody): Observable<BaseBean<RepairListBean>>

    /**
     * app查询投诉记录
     */
    @POST("property/workOrder/complain/list")
    fun getComplainList(@Body info: RequestBody): Observable<BaseBean<RepairListBean>>

    /**
     * 下订单
     */
    @POST("parking/parking/pay/placeAnOrder")
    fun placeAnOrder(@Body info: RequestBody): Observable<BaseBean<PayInfoBean>>

    /**
     * 工单下订单
     */
    @POST("property/workOrder/repair/toPay")
    fun payWorkOrder(@Body info: RequestBody): Observable<BaseBean<WorkOrderPayBean>>

    /**
     * 后台查询活动列表
     */
    @POST("property/activity/list")
    fun getActivityList(@Body info: RequestBody): Observable<BaseBean<ActivityListBean>>

    /**
     * 后台查询指定活动信息
     */
    @GET("property/activity/app/read")
    fun getActivityDetail(@Query("activityId") id: String): Observable<BaseBean<ActivityDetailBean>>

    /**
     * 后台查询指定活动报名人员列表
     */
    @GET("property/activity/registration/list")
    fun getPersonListForActivity(@Query("activityId") activityId: String): Observable<BaseBean<ActivityPersonListBean>>

    /**
     * 后台查询公告列表
     */
    @POST("property/bulletin/list")
    fun getNoticeList(@Body info: RequestBody): Observable<BaseBean<NoticeListBean>>

    /**
     * 查询指定公告详情
     */
    @GET("property/bulletin/get")
    fun getBulletinDetail(@Query("id") id: Int): Observable<BaseBean<BulletinDetailBean>>

    /**
     * 注销用户账户
     */
    @DELETE("system/user/profile/app/disable")
    fun deleteUserAccount(): Observable<BaseBean<Any?>>

    @Multipart
    @POST("file/upload")
    fun uploadHeadImg(@Part file: MultipartBody.Part): Observable<BaseBean<ImgRspBean>>

    @Multipart
    @POST("file/upload")
    fun uploadHeadImg(
        @Query("bucketName") bucketName: String,
        @Part file: MultipartBody.Part,
        @Query("folderName") folderName: String
    ): Observable<BaseBean<ImgRspBean>>

    /**
     * 注册
     */
    @POST("user/register")
    @FormUrlEncoded
    fun register(
        @Field("username") username: String,
        @Field("password") password: String,
        @Field("repassword") repassword: String
    ): Observable<BaseBean<Any?>>

    /**
     * 查询个人车辆
     */
    @POST("parking/app/parking/vehicle/myList")
    @FormUrlEncoded
    fun getMyCarList(
        @Field("vehiclesWithNoPlan") vehiclesWithNoPlan: Boolean,
        @Field("areaId") areaId: String
    ): Observable<BaseBean<List<CarItem>>>

    /**
     * 获取版本号
     */
    @GET("system/config/version")
    fun getVersionName(@Query("type") type: String): Observable<BaseBean<Any?>>

    /**
     * 删除停车查询记录
     */
    @GET("parking/parking/pay/deleteQueryRecord")
    fun deleteQueryCar(
        @Query("vehicleNo") vehicleNo: String,
        @Query("areaId") areaId: String
    ): Observable<BaseBean<Any?>>

    /**
     * 获取缴费详情
     */
    @GET("payment/orders/parking/detail/{orderNo}")
    fun getRecordDetail(@Path("orderNo") orderNo: String): Observable<BaseBean<RecordDetailBean>>

    /**
     * 查询工单子类型(1:保养工单,2:报修工单,3:巡检工单,4:报警工单,5:报事报修,6:投诉建议
     */
    @GET("property/workOrder/type/{pType}/{areaNo}")
    fun queryWorkOrderType(@Path("pType") pType: String,@Path("areaNo") areaNo: String): Observable<BaseBean<List<OrderTypeBean>>>

    /**
     * 查询订单支付结果
     */
    @POST("payment/allinpay/query")
    @FormUrlEncoded
    fun queryPayResult(
        @Field("orderNo") orderNo: String,
        @Field("areaId") areaId: String
    ): Observable<BaseBean<PayResultBean>>

    /**
     * 添加月卡时，计算月卡价格
     */
    @GET("parking/app/parking/parkingCard/feePerMonth")
    fun getMonthPrice(
        @Query("vehicleNo") vehicleNo: String,
        @Query("areaId") areaId: String
    ): Observable<BaseBean<Float>>


    /**
     * 请求计费
     */
    @GET("parking/parking/pay/parkCharging")
    fun parkCharging(
        @Query("vehicleNo") vehicleNo: String
    ): Observable<BaseBean<PayDetail>>

    /**
     * 根据业主ID查询业主关联房屋信息
     */
    @GET("system/owner/list/byOwnerPhone")
    fun getUserRooms(
        @Query("phone") phone: String,
        @Query("areaId") areaId: String,
    ): Observable<BaseBean<List<RoomBean>>>

    /**
     *
     */
    @GET("system/user/listByDeptId")
    fun getUsersByDeptId(
        @Query("areaNo") areaNo: String,
        @Query("companyId") companyId: String,
        @Query("deptId") deptId: String,
    ): Observable<BaseBean<List<UserBean>>>

    /**
     * 业主提交工单
     */
    @POST("property/workOrder/repair/create")
    fun submitReport(@Body body: RequestBody): Observable<BaseBean<Any>>

    /**
     * 查看工单详情
     */
    @GET("property/workOrder/repair/view/{no}")
    fun getOrderDetail(@Path("no") no: String): Observable<BaseBean<OrderDetailBean>>

    /**
     * 查看投诉详情
     */
    @GET("property/workOrder/complain/view/{no}")
    fun getComplaintDetail(@Path("no") no: String): Observable<BaseBean<ComplaintDetailBean>>

    /**
     * 受理投诉
     */
    @POST("property/workOrder/complain/take")
    fun takeComplaint(@Body body: RequestBody): Observable<BaseBean<Any>>

    /**
     * 反馈投诉
     */
    @POST("property/workOrder/complain/handle")
    fun handleComplaint(@Body body: RequestBody): Observable<BaseBean<Any>>

    /**
     * 投诉转单
     */
    @POST("property/workOrder/complain/turn")
    fun turnComplaint(@Body body: RequestBody): Observable<BaseBean<Any>>

    /**
     * 查询用户详细信息
     */
    @GET("system/user/getInfo")
    fun getUserDetailInfo(): Observable<UserInfoBean>

    /**
     * 物业处理完成
     */
    @POST("property/workOrder/repair/handle")
    fun handleWorkOrder(@Body body: RequestBody): Observable<BaseBean<Any>>

    /**
     * 判断是否是领导
     */
    @GET("system/user/isDeptManagerById/{id}")
    fun isManager(@Path("id") id: Int): Observable<BaseBean<Boolean>>

    /**
     * 物业审核
     */
    @POST("property/workOrder/repair/check")
    fun checkOrder(@Body body: RequestBody): Observable<BaseBean<Any?>>

    /**
     * 业主撤销工单
     */
    @DELETE("property/workOrder/repair/cancel/{no}")
    fun cancelWorkOrder(@Path("no") no: String): Observable<BaseBean<Any?>>

    /**
     * 业主撤销工单
     */
    @DELETE("property/workOrder/repair/delete/{no}")
    fun deleteWorkOrder(@Path("no") no: String): Observable<BaseBean<Any?>>


    /**
     */
    @POST("property/inspectTask/ready")
    fun inspectTaskReady(@Body info: RequestBody): Observable<BaseBean<TakeCareBean>>

    /**
     */
    @POST("property/checkTask/ready")
    fun checkTaskReady(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/checkTask/scanPage")
    fun patrolRecordOrder(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/inspectTask/exec")
    fun inspectTaskExec(@Body info: RequestBody): Observable<BaseBean<TakeCareBean>>

    /**
     */
    @POST("property/checkTask/exec")
    fun checkTaskExec(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/inspectTask/finish")
    fun inspectTaskFinish(@Body info: RequestBody): Observable<BaseBean<TakeCareBean>>

    /**
     */
    @POST("property/checkTask/finish")
    fun checkTaskFinish(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/inspectTask/taskPage")
    fun inspectTaskTaskPage(@Body info: RequestBody): Observable<BaseBean<TakeCareRecordBean>>

    /**
     */
    @POST("property/inspectTask/scanPage")
    fun inspectTaskTaskScanPage(@Body info: RequestBody): Observable<BaseBean<TakeCareRecordBean>>


    /**
     */
    @POST("property/inspectTask/unAssign")
    fun inspectTaskUnAssign(@Body info: RequestBody): Observable<BaseBean<TakeCareDispatchBean>>

    /**
     */
    @POST("property/checkTask/unAssign")
    fun patrolTaskUnAssign(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/checkTask/assigned")
    fun patrolTaskAssign(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/inspectTask/unConfirm")
    fun inspectTaskUnConfirm(@Body info: RequestBody): Observable<BaseBean<TakeCareDispatchBean>>

    /**
     */
    @POST("property/inspectTask/confirm")
    fun inspectTaskConfirm(@Body info: RequestBody): Observable<BaseBean<TakeCareDispatchBean>>

    /**
     */
    @POST("property/checkTask/unConfirm")
    fun checkTaskUnConfirm(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/checkTask/confirm")
    fun checkTaskConfirm(@Body info: RequestBody): Observable<BaseBean<PatrolBean>>

    /**
     */
    @POST("property/inspectTask/assigned")
    fun inspectTaskAssigned(@Body info: RequestBody): Observable<BaseBean<TakeCareDispatchBean>>

    /**
     */
    @POST("property/workOrder/ready")
    fun workOrderReady(@Body info: RequestBody): Observable<BaseBean<WorkOrderBean>>

    /**
     */
    @POST("property/workOrder/exec")
    fun workOrderExec(@Body info: RequestBody): Observable<BaseBean<WorkOrderBean>>

    /**
     */
    @POST("property/workOrder/finish")
    fun workOrderFinish(@Body info: RequestBody): Observable<BaseBean<WorkOrderBean>>

    /**
     */
    @GET("property/common/proWorkOrder/getHandleUser/{orderTypeId}")
    fun getHandleUser(@Path("orderTypeId") orderTypeId: String): Observable<BaseBean<List<MembersBean>>>
    /**
     *
     */
    @GET("property/common/proWorkOrder/orderOperate/{orderId}")
    fun orderOperate(@Path("orderId") orderId: String): Observable<BaseBean<List<OrderOperate>>>
    
    /**
     * APP物业员工查询评价列表
     */
    @POST("system/houseKeeper/evaluate/search/employee")
    fun getScoreList(@Body info: RequestBody): Observable<BaseBean<ScoreListBean>>

    /**
     * APP物业端对评论进行回复
     */
    @POST("system/houseKeeper/evaluate/reply")
    fun replyEvaluate(@Body info: RequestBody): Observable<BaseBean<Boolean>>

    /**
     */
    @GET("property/sys/common/listUser")
    fun listUser(@Query("areaId") areaId: String): Observable<BaseBean<List<MembersBean>>>


    /**
     */
    @GET("property/common/proWorkOrder/getFullOrder/{orderId}")
    fun getFullOrder(@Path("orderId") orderId: String): Observable<BaseBean<WorkOrderDetailBean>>

    /**
     */
    @GET("property/inspectTask/getOrder/{orderId}")
    fun getTakeCareFullOrder(@Path("orderId") orderId: String): Observable<BaseBean<WorkOrderDetailBean>>


    /**
     */
    @GET("property/checkTask/getOrder/{orderId}")
    fun getPatrolFullOrder(@Path("orderId") orderId: String): Observable<BaseBean<PatrolOrderDetailBean>>

    /**
     */
    @POST("property/common/proWorkOrder/assign")
    fun assign(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/common/proWorkOrder/assignBatch")
    fun assignBatch(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/inspectTask/check")
    fun inspectTaskCheck(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/checkTask/check")
    fun checkTaskCheck(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     * 获取月卡列表
     */
    @GET("property/workOrder/today")
    fun workOrderToday(): Observable<BaseBean<Map<String, Int>>>

    /**
     */
    @POST("property/common/proWorkOrder/accept")
    fun workOrderAccept(@Body info: RequestBody): Observable<BaseBean<Any>>

    @GET("property/workOrder/percent")
    fun workOrderPercent(@Query("type") type: Int): Observable<BaseBean<List<PercentBean>>>

    @GET("property/workOrder/time")
    fun workOrderTime(): Observable<BaseBean<List<WorkOrderTimeBean>>>


    /**
     */
    @POST("property/common/proWorkOrder/transfer")
    fun workOrderTransfer(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/inspectTask/register")
    fun inspectTaskRegister(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/alarmRecord/register")
    fun alarmTaskRegister(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/inspectTask/finishOrder")
    fun inspectTaskFinishOrder(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/checkTask/finishOrder")
    fun checkTaskFinishOrder(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/alarmRecord/finishOrder")
    fun alarmTaskFinishOrder(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @POST("property/checkTask/register")
    fun checkTaskRegister(@Body info: RequestBody): Observable<BaseBean<Any>>

    /**
     */
    @GET("property/alarmRecord/getOrder/{orderId}")
    fun getAlarmFullOrder(@Path("orderId") orderId: String): Observable<BaseBean<AlarmOrderDetailBean>>

    @Multipart
    @Headers("url_name:img")
    @POST("file/upload")
    fun uploadImg(
        @QueryMap() params: Map<String, String>,
        @Part file: MultipartBody.Part
    ): Observable<BaseBean<ImgRspBean>>

    /**
     * 获取部门列表
     */
    @GET("system/dept/listByCompany")
    fun getDeptList(@Query("companyId") companyId: String): Observable<BaseBean<List<ComplaintDeptBean>>>

    /**
     * 获取抬杆列表
     */
    @POST("parking/app/parking/remoteLift/deviceList")
    fun getCarAccessList(@Body params: RequestBody): Observable<BaseBean<List<CarAceessItemBean>>>

    /**
     * 远程抬杆
     */
    @POST("parking/app/parking/remoteLift/action")
    fun carAccessAction(@Body params: RequestBody): Observable<BaseBean<Any?>>
}